package com.cdream.basic.algorithm.leetcode.array;

import java.util.LinkedList;

/**
 * @author cdream
 * @date 10/21/21
 */
public class Question66 {
    public int[] plusOne(int[] digits) {
        LinkedList res = new LinkedList<Integer>();
        int mod = 1;
        for(int i = digits.length-1; i>=0;i--){
            int digit = digits[i];
            digit = digit + mod;
            res.push(digit % 10);
            mod = digit /10;
        }
        return res.stream().mapToInt(a->(int)a).toArray();

    }
}
